package com.qingcloud.fexecutor.base.enums;

public enum BaseAppDeployTypeEnum {

    FILE(1, "文件部署"),
    DOCKER(2, "Docker部署");

    public final Integer code;
    public final String name;

    BaseAppDeployTypeEnum(int code, String name) {
        this.code = code;
        this.name = name;
    }

    public static BaseAppDeployTypeEnum findByName(String name) {
        for (BaseAppDeployTypeEnum type : BaseAppDeployTypeEnum.values()) {
            if (type.name().equalsIgnoreCase(name)) {
                return type;
            }
        }
        return null;
    }

    public static String getNameByCode(Integer code) {
        for (BaseAppDeployTypeEnum type : BaseAppDeployTypeEnum.values()) {
            if (type.code.equals(code)) {
                return type.name;
            }
        }
        return "";
    }
}
